﻿using System.Collections.Generic;

namespace Lexware.Tools.ProjectPropertyOverview
{
    /// <summary>
    /// 
    /// </summary>
    internal class DefaultConfigurationPropertyList
    {
        private readonly Dictionary<string, List<DefaultConfigurationPropertyItem>> _defaultProperties;

        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultConfigurationPropertyList"/> class.
        /// </summary>
        public DefaultConfigurationPropertyList()
        {
            _defaultProperties = new Dictionary<string, List<DefaultConfigurationPropertyItem>>();
        }

        /// <summary>
        /// Gets the default properties for configuration.
        /// </summary>
        /// <param name="configName">Name of the config.</param>
        /// <returns></returns>
        public List<DefaultConfigurationPropertyItem> GetDefaultPropertiesForConfiguration(string configName)
        {
            return _defaultProperties.ContainsKey(configName) ? _defaultProperties[configName] : null;
        }

        /// <summary>
        /// Adds the default configuration.
        /// </summary>
        /// <param name="configName">Name of the config.</param>
        /// <param name="list">The list.</param>
        public void AddDefaultConfiguration(string configName, List<DefaultConfigurationPropertyItem> list)
        {
            if (!_defaultProperties.ContainsKey(configName))
            {
                _defaultProperties.Add(configName, list);
            }
        }

        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <value>The count.</value>
        public int Count
        {
            get
            {
                return _defaultProperties.Count;
            }
        }
    }


    /// <summary>
    /// 
    /// </summary>
    internal class DefaultConfigurationPropertyItem
    {
        private string _name;
        private object _value;

        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultConfigurationPropertyItem"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        public DefaultConfigurationPropertyItem(string name, object value)
        {
            _name = name;
            _value = value;
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _value = value;
            }
        }

        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <value>The value.</value>
        public object Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }
    }
}
